/* ******************************************************************************* C-DAC Tech Workshop : hyPACK-2013 October 15-18, 2013 Example 2.6 : mpicpp-vv-mult-blk-cyclic.C Objective : MPI program to compute dot product of two vectors using block-striped cyclic distribution of data Input : Process with rank 0 reads a real vectors of size n. Output : Process with rank 0 prints the final dot product of two vectors. Necessary Conditions : Number of processors should be divisible by vector size. Created : August-2013 E-mail : hpcfte@cdac.in ***************************************************************************** */ #include #include #include #include #include"mpi.h" using namespace std; int main(int argc,char *argv[]) { int root=0,myrank,numprocs,i,j,k=0; int vsize; int scatsize; int *vector_a,*vector_b,*buffer_a,*buffer_b; int sum=0,finalvalue=0; int *temp_a,*temp_b; FILE *fp; MPI::Init(argc,argv); numprocs=MPI::COMM_WORLD.Get_size(); myrank=MPI::COMM_WORLD.Get_rank(); if(myrank==root) { fp=fopen("mvdata.inp","r"); if(fp==NULL) { cout<<"\nInput Data File not Found. So terminating......"; MPI::Finalize(); exit(-1); } fscanf(fp,"%d\n",&vsize); /* Allocation of Memory to hold input....*/ vector_a= new int[vsize]; vector_b= new int[vsize]; /* reading data frm file....*/ for(i=0;i" <